<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head"></head>
<body>

<div th:replace="common/header :: header"></div>

<div class="layui-container fly-marginTop fly-user-main">


  <div th:replace="common/user-nav :: user-nav"></div>

  <div class="fly-panel fly-panel-user" pad20 style="padding-top:20px;">

    <div class="fly-msg" th:if="${isIfverified == 0}" style="margin-top: 15px;">
      您的邮箱尚未验证，这比较影响您的帐号安全，<a th:href="@{/user/activate}">立即去激活？</a>
    </div>

    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title" id="LAY_mine">
        <li data-type="mine-jie" lay-id="index" class="layui-this">我发的帖</li>
        <li data-type="collection" data-url="/collection/find/" lay-id="collection">我收藏的帖</li>
      </ul>
      <div class="layui-tab-content" style="padding: 20px 0;">
        <div class="layui-tab-item layui-show">
          <div id="LAY_page"></div>
        </div>
        <div class="layui-tab-item">
          <div id="LAY_myCollectioncard"></div>
        </div>
      </div>
    </div>
  </div>
</div>

<div th:replace="common/footer :: footer"></div>
<script th:replace="common/common-js :: js"></script>
<script th:inline="javascript" type="text/javascript">
  /*<![CDATA[*/
  layui.config({
    base: '/res/mods/'
  }).extend({
    fly: 'index'
  }).use(['fly','user','table'],function () {
    var table = layui.table;

    //我发的贴
    table.render({
      elem: '#LAY_page'
      ,url: /*[[@{/user/myjie}]]*/'null'
      ,method: 'post'
      ,cols: [
        [
          {field: 'title', title: '帖子标题', minWidth: 300, templet: '<div><a href="/q/jie/{{ d.jieId }}" target="_blank" class="layui-table-link">{{ d.jieTitle }}</a></div>'}
          ,{field: 'jieEssence', title: '状态', width: 100, align: 'center', templet: function(d){
            if(d.jieStatus.jieEssence == true){
              return '<span style="color: #ccc;">置顶</span>';
            } else if(d.jieStatus.jieTop == true){
              return '<span style="color: #FF5722;">加精</span>';
            } else {
              return '<span style="color: #999;">正常</span>'
            }
          }}
          ,{field: 'jieEnd', title: '结贴', width: 100, align: 'center', templet:function(d){
            if(d.jieStatus == null){
              return '<span style="color: #ccc;">未结</span>';
            }
            return d.jieStatus.jieEnd ? '<span style="color: #5FB878;">已结</span>' :'<span style="color: #ccc;">未结</span>'
          }}
          ,{field: 'd.jieCreateTime', title: '发表时间', width: 120, align: 'center', templet: '<div>{{ layui.util.timeAgo(d.jieCreateTime, 1) }}</div>'}
          ,{title: '数据', width: 150, templet: '<div><span style="font-size: 12px;">{{d.jieStatus.jieLookNumber}}阅/{{d.jieStatus.jieReplyNumber}}答</span></div>'}
          ,{title: '操作', width: 100, templet: function(d){
            return !d.jieStatus.jieEnd ? '<a class="layui-btn layui-btn-xs" href="/jie/update/'+ d.jieId +'" target="_blank">编辑</a>' : ''
          }}
        ]
      ]
      ,page: true
      ,skin: 'line'
    });


    table.render({
      elem: '#LAY_myCollectioncard'
      ,url: /*[[@{/collection/list}]]*/'null'
      ,cols: [
        [
          {field: 'title', title: '帖子标题', minWidth: 300, templet: '<div><a href="/q/jie/{{ d.jie.jieId }}" target="_blank" class="layui-table-link">{{ d.jie.jieTitle }}</a></div>'}
          ,{field: 'collection_timestamp', title: '收藏时间', width: 120, align: 'center', templet: '<div>{{ layui.util.timeAgo(d.collectionTime, 1) }}</div>'}
        ]
      ]
      ,page: true
      ,skin: 'line'
    });

  });

  /*]]>*/
</script>

</body>
</html>